

package ro.ase.catalog.security.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import ro.ase.catalog.beans.Authority;
import ro.ase.catalog.beans.Role;
import ro.ase.catalog.security.dao.IAuthorityDAO;
import ro.ase.catalog.security.service.ISecurityInterceptor;

import java.util.List;


public class SecurityInterceptorImpl implements ISecurityInterceptor {

    @Autowired
    private IAuthorityDAO authorityDAO;

    public List<Authority> loadAuthorities(String type) {
        
        List<Authority> authorities = authorityDAO.findByType(type);
        for (Authority authority : authorities) {
            for (Role role : authority.getRoles()) {
                role.getName();
            }
        }
        return authorities;
    }
}
